package com.museum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.museum.entity.DO.Token;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Ruiwen
 * @since 2020-12-19
 */
@Repository
public interface TokenMapper extends BaseMapper<Token> {
    /**
     * 查询登陆状态
     * @param userID
     * @return
     */
    @Select("select * FROM token WHERE userId=#{userId} AND isAvailability='0'")
    Token isExit(Integer userID);
    @Update("update token set isAvailability = 1 where token = #{token}")
    int logout(String token);
}
